package com.gitee.srurl.core.util;

import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;

import java.util.concurrent.ThreadPoolExecutor;

/**
 * @author zxw
 * @date 2023/4/29 22:02
 */
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public abstract class ThreadPoolUtil {

    private static final ThreadPoolExecutor executor = SpringContextUtil.getBean("threadPoolExecutor");

    public static void submit(Runnable runnable) {
        executor.execute(runnable);
    }

    public static ThreadPoolExecutor getExecutor() {
        return executor;
    }
}
